# -*- coding: utf-8 -*-
"""
@Time ： 2021/7/30 13:29
@Auth ： Mr.掌心 2929184523
@Company ：特斯汀学院 @testingedu.com.cn
@Function ：请输入模块功能描述
"""
from PO.pages.base_page import BasePage


class SearchPage(BasePage):
    SearchPage_locators = {
        '_search_box_locator': '//*[@id="q"]',
        '_search_button_locator': '//*[@id="sourch_form"]/a',
        '_goods_name_locator': '//div[@class="shop-list-splb p"]//div[@class="shop_name2"]/a'
    }

    def get_search_goods(self, text):
        self.driver.get('http://testingedu.com.cn:8000/Home/user/index.html')
        self.input(self.SearchPage_locators['_search_box_locator'], text)
        self.clickjs(self.SearchPage_locators['_search_button_locator'])

        goods = self.find_eles(self.SearchPage_locators['_goods_name_locator'])
        for good in goods:
            print(good.text)